import request from '@/utils/request'

// 查询用户订单列表
export function listData(query) {
  return request({
    url: '/data/user/order/',
    method: 'get',
    params: query
  })
}

// 查询用户订单详细
export function getDetail(id) {
  return request({
    url: '/data/user/order/' + id,
    method: 'get'
  })
}

// 生成预支付订单
export function createData(data) {
  return request({
    url: '/data/user/order/createOrder',
    method: 'post',
    data: data
  })
}


// 修改用户订单
export function updateData(data) {
  return request({
    url: '/data/user/order/',
    method: 'put',
    data: data
  })
}

// 删除用户订单
export function delData(id) {
  return request({
    url: '/data/user/order/' + id,
    method: 'delete'
  })
}

// 订单赠品
export function sendUserGift(data) {
  return request({
    url: '/data/user/order/gift',
    method: 'post',
    data: data
  })
}

//支付操作
export function goPay(data) {
  return request({
    url: '/data/user/order/payOrder',
    method: 'post',
    params: data
  })
}
//系统支付操作
export function sysPay(data) {
  return request({
    url: '/data/user/order/sysOrder',
    method: 'post',
    params: data
  })
}


//用户订单明细列表
export function particularsList(query) {
  return request({
    url: '/data/user/order/particulars',
    method: 'get',
    params: query
  })
}
//用户订单明细详情
export function particularDetail(id) {
  return request({
    url: '/data/user/orderDetail/particulars/'+ id,
    method: 'get'
  })
}
//用户订单明细汇总
export function particularSum(query) {
  return request({
    url: '/data/user/orderDetail/all/particulars',
    method: 'get',
    params: query
  })
}
//待支付订单取消
export function cancelOrder(id) {
  return request({
    url: '/data/user/order/' + id,
    method: 'delete'
  })
}
//取消待收款订单
export function unpaidCancel(query) {
  return request({
    url: '/data/user/order/cancel',
    method: 'post',
    params:query
  })
}
